#!/bin/bash

# 创建必要的目录
mkdir -p ~/docker/minio/data
mkdir -p ~/docker/minio/config

# 停止并删除已存在的容器
docker stop minio 2>/dev/null
docker rm minio 2>/dev/null

# 运行 MinIO 容器
docker run -d \
  --name minio \
  --restart=always \
  -p 9000:9000 \
  -p 9001:9001 \
  -v ~/docker/minio/data:/data \
  -v ~/docker/minio/config:/root/.minio \
  -e "MINIO_ROOT_USER=minioadmin" \
  -e "MINIO_ROOT_PASSWORD=minioadmin" \
  quay.io/minio/minio server /data --console-address ":9001"

# 检查容器状态
echo "Checking MinIO container status..."
docker ps | grep minio

echo "MinIO is running..."
echo "Console: http://localhost:9001"
echo "API Endpoint: http://localhost:9000"
echo "Username: minioadmin"
echo "Password: minioadmin" 